package cn.iocoder.yudao.module.famous.doctor.dal.mysql.question;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.famous.doctor.dal.dataobject.question.FamQuestionDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.famous.doctor.controller.admin.question.vo.*;

/**
 * 常见问题 Mapper
 *
 * @author 档案
 */
@Mapper
public interface FamQuestionMapper extends BaseMapperX<FamQuestionDO> {

    default PageResult<FamQuestionDO> selectPage(FamQuestionPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<FamQuestionDO>()
                .eqIfPresent(FamQuestionDO::getDescribed, reqVO.getDescribed())
                .eqIfPresent(FamQuestionDO::getAnswer, reqVO.getAnswer())
                .eqIfPresent(FamQuestionDO::getDiseaseLabelIds, reqVO.getDiseaseLabelIds())
                .eqIfPresent(FamQuestionDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(FamQuestionDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(FamQuestionDO::getReadNum, reqVO.getReadNum())
                .orderByDesc(FamQuestionDO::getId));
    }

    default List<FamQuestionDO> selectList(FamQuestionExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<FamQuestionDO>()
                .eqIfPresent(FamQuestionDO::getDescribed, reqVO.getDescribed())
                .eqIfPresent(FamQuestionDO::getAnswer, reqVO.getAnswer())
                .eqIfPresent(FamQuestionDO::getDiseaseLabelIds, reqVO.getDiseaseLabelIds())
                .eqIfPresent(FamQuestionDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(FamQuestionDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(FamQuestionDO::getReadNum, reqVO.getReadNum())
                .orderByDesc(FamQuestionDO::getId));
    }

}
